package com.lxw.redis.study;

import com.lxw.mutils.generator.MGenerator;
import com.lxw.mutils.generator.MgConfig;

import java.util.ArrayList;
import java.util.List;

public class GeneratorMain {
    private static String contextPath = "/redis-study";

    public static void main(String[] args) {
        List<String> tableNames = new ArrayList<>();
        tableNames.add("emp");
        tableNames.add("dept");
        for (String tableName : tableNames) {
            generateCode(tableName);
//        generateSql(tableName);
        }

    }

    public static void generateCode(String tableName) {
        MgConfig mgConfig = new MgConfig();
        // 全局配置
//        mgConfig.setProjectName("expertservice");
        mgConfig.setDbUrl("jdbc:mysql://150.158.33.191:3306/scott?useUnicode=true&characterEncoding=utf-8&useSSL=false");
        mgConfig.setDbUserName("root");
        mgConfig.setDbPassword("Mysql_Yxh1s,Dtq3d.Ttszx,Bcg$s.");
        mgConfig.setSortCode(true);
        mgConfig.setGroup("com.lxw.redis.study");
        mgConfig.setTableName(tableName);
        mgConfig.setContextPath(contextPath);
        mgConfig.setBasicEntity("BasicEntity");
        mgConfig.setLombok(false);
        MGenerator.generator(mgConfig);
    }

    public static void generateSql(String tableName) {
        MGenerator.generatorSql(tableName);
    }
}
